home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 3 / Gold Medal Software - Volume 3 (Gold Medal) (1994).iso / stats / nonlin31.arj / PIECE.NLR < prev    next >
Text File  |  1994-01-23  |  2KB  |  72 lines

  1. /*
  2.  *  Fit a piecewise linear function that pivots at X=5.
  3.  *  When X is less than 5, the slope is B1.
  4.  *  When X is greater than or equal to 5, the slope is B2.
  5.  *  B0 is the Y value when X=5 (i.e., at the pivot point).
  6.  */
  7. Title "Piecewise linear function";
  8. Variables X,Y;
  9. Parameter B0;
  10. Parameter B1;
  11. Parameter B2;
  12. Constant Pivot=5;        // X value at which bend occurs
  13. if (x < Pivot) {
  14.     Function Y = B0+B1*(X-Pivot);
  15. } else {
  16.     Function Y = B0+B2*(X-Pivot);
  17. }
  18. Plot residual;
  19. Rplot grid;
  20. Data;
  21. 1.0000        9.0640
  22. 1.1429        9.3975
  23. 1.2857        9.2018
  24. 1.4286        9.2857
  25. 1.5714        8.9093
  26. 1.7143        9.3477
  27. 1.8571        9.0515
  28. 2.0000        8.8722
  29. 2.1429        9.3411
  30. 2.2857        8.8253
  31. 2.4286        8.9658
  32. 2.5714        8.4049
  33. 2.7143        8.4536
  34. 2.8571        8.8517
  35. 3.0000        8.8919
  36. 3.1429        8.4210
  37. 3.2857        8.7708
  38. 3.4286        8.6519
  39. 3.5714        8.4829
  40. 3.7143        8.0907
  41. 3.8571        7.9835
  42. 4.0000        8.0832
  43. 4.1429        8.2473
  44. 4.2857        7.5845
  45. 4.4286        7.6238
  46. 4.5714        7.6233
  47. 4.7143        7.5825
  48. 4.8571        7.7350
  49. 5.0000        7.6635
  50. 5.1429        7.6477
  51. 5.2857        7.1760
  52. 5.4286        7.2312
  53. 5.5714        7.1163
  54. 5.7143        6.8115
  55. 5.8571        6.8880
  56. 6.0000        6.7678
  57. 6.1429        6.4633
  58. 6.2857        6.0894
  59. 6.4286        5.7891
  60. 6.5714        6.1622
  61. 6.7143        5.9032
  62. 6.8571        5.8183
  63. 7.0000        5.4021
  64. 7.1429        5.2677
  65. 7.2857        5.3045
  66. 7.4286        5.1546
  67. 7.5714        4.7516
  68. 7.7143        4.8867
  69. 7.8571        4.5282
  70. 8.0000        4.6656
  71.  
  72.